#pragma once
#include "IComponent.h"
#include "SpriteComponent.h"

namespace ZeEngine
{
    class SpriteSheet;
    class SpriteSheetAnimation;

    class AnimatedComponent : public IRenderableComponent
    {
		friend class SDLRenderable;

    public:
        AnimatedComponent(SpriteSheet* pSpriteSheet);
        virtual ~AnimatedComponent();

        void Update(u32 deltaMS);
        void SetCurrentAnimation(const std::string& strAnimation);

        const SDL_Rect  GetFrameBoundary()     const;

        virtual void Reset() override;

    private:     
        u32 m_currentFrame;
        s32 m_frameIncrement;
        s32 m_deltaTimeMS;

        SpriteSheet* m_pSpriteSheet;
        const SpriteSheetAnimation* m_pCurrentAnimation;
        std::string m_currentAnimation;

	private:
        virtual void Render(SDL_Renderer& renderer, const Vector2D<float> position, const f32 rotation, f32 interpolation) override;
		virtual SDLTexture* GetTexture() const override;

#define ICOMPONENT_I
#include ICOMPONENT_H
    };
}

